package com.app.outdoor.InvoikeServices;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.app.Network.Protocol;

public class CayThaoLuanInvoike extends BaseInvoike {
	private static String url=Protocol.SERVER_URL+"/CayThaoLuanServlet";
	
	public static String getSubject(int idNguoiDung) throws Exception{
		String rs="";
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.LAY_DANH_SACH_CAY));
		params.add(new BasicNameValuePair(Protocol.ID, idNguoiDung+""));		
		rs=post(url, params);
		return rs;
	}
	public static String getCay(int idCay) throws Exception{
		String rs="";
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.LAY_CAY));
		params.add(new BasicNameValuePair(Protocol.ID, idCay+""));		
		rs=post(url, params);
		return rs;
	}
	public static String taoCayMoi(int idNhom, int idNguoiTao, String noiDung) throws Exception{
		String rs="";
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.TAO_CAY));
		params.add(new BasicNameValuePair(Protocol.ID_NGUOI_DUNG, idNguoiTao+""));
		params.add(new BasicNameValuePair(Protocol.ID_NHOM, idNhom+""));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, noiDung));
		
		rs=post(url, params);
		return rs;
	}
	public static String themNode(int idNodeCha, int idCay, int idNguoiTao,String noiDung, String ghiChu) throws Exception{
		String rs="";
		ArrayList<NameValuePair>params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.ID, idNodeCha+""));
		params.add(new BasicNameValuePair(Protocol.ID_CAY, idCay+""));
		params.add(new BasicNameValuePair(Protocol.ID_NGUOI_DUNG, idNguoiTao+""));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, noiDung));
		params.add(new BasicNameValuePair(Protocol.GHI_CHU, ghiChu));
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.THEM_NODE));
		rs=post(url, params);
		return rs;
			
	}
	public static String capNhatNode(int idNode, int idCay,String noiDung, String ghiChu) throws Exception{
		String rs="";
		ArrayList<NameValuePair>params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.ID, idNode+""));
		params.add(new BasicNameValuePair(Protocol.ID_CAY, idCay+""));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, noiDung));
		params.add(new BasicNameValuePair(Protocol.GHI_CHU, ghiChu));
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.CAP_NHAT_NODE));
		rs=post(url, params);
		return rs;
			
	}
	public static String xoaNode(int idNodeCha, int idCay) throws Exception{
		String rs="";
		ArrayList<NameValuePair>params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.ID, idNodeCha+""));
		params.add(new BasicNameValuePair(Protocol.ID_CAY, idCay+""));
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.XOA_NODE));
		rs=post(url, params);
		return rs;
			
	}
	
}
